﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SingleThread {
    public class Item {
        int messagesCount = 0;
        string msg = "ciao";


        public Item() {
            one();
        }
        public void one() {
            two();
        }

        public void two() {
            tree();
        }

        public void tree() {
            four();
        
        }
        public void four() {
            five();

        }
        public void five() {
            six();

        }
        public void six() {
            seven();

        }
        public void seven() {
            Console.WriteLine(this.msg);
            throw new Exception("error");
        }


        public void PrintMessage() {
            Console.WriteLine("Message from Item!");
            messagesCount++;
            if (messagesCount < 2)
                throw new Exception();
            //this.PrintMessage();
        }
    }
}
